public class ClubStatistics {
    public static void main(String[] args) {
        // 定义5个社团的信息数组（名称、报名人数、新生人数）
        String[] names = {"编程社", "动漫社", "志愿者社", "音乐社", "话剧社"};
        int[] totalMembers = {28, 35, 42, 22, 30};
        int[] newMembers = {15, 20, 18, 12, 16};

        // 计算并存储每个社团的新生占比
        double[] newMemberRates = new double[names.length];

        // 计算每个社团的新生占比（保留1位小数）
        for (int i = 0; i < names.length; i++) {
            // 避免除零错误
            if (totalMembers[i] > 0) {
                double rate = (double) newMembers[i] / totalMembers[i] * 100;
                // 保留1位小数
                newMemberRates[i] = Math.round(rate * 10) / 10.0;
            } else {
                newMemberRates[i] = 0.0;
            }
        }

        // 找出报名人数最多的社团
        int maxIndex = 0;
        for (int i = 1; i < totalMembers.length; i++) {
            if (totalMembers[i] > totalMembers[maxIndex]) {
                maxIndex = i;
            }
        }

        // 输出所有社团的完整信息
        System.out.println("=== 所有社团信息 ===");
        for (int i = 0; i < names.length; i++) {
            System.out.println(
                    "社团名称：" + names[i] + "\n" +
                            "  报名人数：" + totalMembers[i] + "\n" +
                            "  新生人数：" + newMembers[i] + "\n" +
                            "  新生占比：" + newMemberRates[i] + "%\n"
            );
        }

        // 输出报名人数最多的社团
        System.out.println("=== 报名人数最多的社团 ===");
        System.out.println(
                "社团名称：" + names[maxIndex] + "\n" +
                        "  报名人数：" + totalMembers[maxIndex] + "\n" +
                        "  新生人数：" + newMembers[maxIndex] + "\n" +
                        "  新生占比：" + newMemberRates[maxIndex] + "%"
        );
    }
}
